package de.cachaca.lildancefreak.valerie;

public class Reverse {

	public char[] reverse(char[] word) {
		
		char[] result = new char[word.length];
		int j = 0;
		
		for (int i = word.length-1; i >= 0; i--) {
			
			
			result[j] = word[i];
			j++;
			
		}
		
		return result;
		
		
	}
	
	public String reverse(String string) {
		
		String result = "";
		
		for (int i = 0; i < string.length(); i++) {
			
			result = result + string.charAt(string.length() -1 -i);
			
		}
		
		/*char[] tempChar = new char[string.length()];
		tempChar = string.toCharArray();
		char[] resultChar = new char [tempChar.length];
		String resultString;
		int j=0;
		
		for (int i = tempChar.length -1; i >= 0; i--) {
			
			resultChar [j] = tempChar[i];
			j++;
			
		}
		
		resultString = new String(resultChar);**/
		
		return result;
	}
	
	
	public static void main(String[] args) {
		char[] word = new char[] { 'v', 'a','l','e','r','i','e' };
		new Reverse().reverse(word );
		
		new Reverse().reverse("pierre");
	}



}
